package org.hbnu.bookmanage001.entity;

import java.util.Date;
import java.util.Objects;

//图书实体类
public class Book {
    //编号
    public int id;

    //名字
    public  String name;

    //类型
    public String type;

    //作者
    public   String author;

    //价格
    public   float price;

    //图片
    public  String pic;

    //出版日期
    public  java.util.Date createDate;


    public Book() {
    }

    public Book(int id, String name, String type, String author, float price, String pic, Date createDate) {
        this.id = id;
        this.name = name;
        this.type = type;
        this.author = author;
        this.price = price;
        this.pic = pic;
        this.createDate = createDate;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Book book = (Book) o;
        return id == book.id && Float.compare(price, book.price) == 0 && Objects.equals(name, book.name) && Objects.equals(author, book.author) && Objects.equals(pic, book.pic) && Objects.equals(createDate, book.createDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, author, price, pic, createDate);
    }
}
